// 非机动车类，作为基类抽象类，提取公共属性和抽象方法
abstract class NonMotorVehicle {
    protected String color;
    protected String brand;

    public NonMotorVehicle(String color, String brand) {
        this.color = color;
        this.brand = brand;
    }

    // 抽象方法，由子类去具体实现产品介绍逻辑
    public abstract void introduce();
}

// 自行车类，继承自非机动车类
class Bicycle extends NonMotorVehicle {
    private int seats;

    public Bicycle(String color, String brand, int seats) {
        super(color, brand);
        this.seats = seats;
    }

    @Override
    public void introduce() {
        System.out.println("这是一辆" + brand + "品牌的自行车，颜色是" + color + "，座位数为" + seats + "个。");
    }
}

// 三轮车类，继承自非机动车类
class Tricycle extends NonMotorVehicle {
    private int wheels;

    public Tricycle(String color, String brand, int wheels) {
        super(color, brand);
        this.wheels = wheels;
    }

    @Override
    public void introduce() {
        System.out.println("这是一辆" + brand + "品牌的三轮车，颜色是" + color + "，轮子数量为" + wheels + "个。");
    }
}

// 电动车类，继承自非机动车类
class ElectricVehicle extends NonMotorVehicle {
    private int battery;

    public ElectricVehicle(String color, String brand, int battery) {
        super(color, brand);
        this.battery = battery;
    }

    @Override
    public void introduce() {
        System.out.println("这是一辆" + brand + "品牌的电动车，颜色是" + color + "，电量剩余 " + battery + "格。");
    }
}

// 测试类，包含main方法，用于创建各类车辆对象并调用介绍方法
public class VehicleDemo {
    public static void main(String[] args) {
        Bicycle bicycle = new Bicycle("红色", "捷安特", 1);
        Tricycle tricycle = new Tricycle("蓝色", "金彭", 3);
        ElectricVehicle electricVehicle = new ElectricVehicle("黑色", "爱玛", 4);

        bicycle.introduce();
        tricycle.introduce();
        electricVehicle.introduce();
    }
}
